package com.jrx.anytxn.reporting.job.xib.step;

import com.jrx.anytxn.transaction.entity.AmLoanAccountInfo;
import com.jrx.anytxn.transaction.mapper.ext.ExtAmLoanAccountInfoMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 计算客户日终余额Writer
 * @author liuzb
 */
@Service
public class CustBalHandleWriter implements ItemWriter<AmLoanAccountInfo> {

    @Resource
    private ExtAmLoanAccountInfoMapper extAmLoanAccountInfoMapper;

    @Override
    public void write(List<? extends AmLoanAccountInfo> items) {
        if(CollectionUtils.isNotEmpty(items)) {
            for (AmLoanAccountInfo item : items) {
                extAmLoanAccountInfoMapper.updateByPrimaryKey(item);
            }
        }
    }
}
